package com.sean.dao;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.sean.dto.User;

@SuppressWarnings("unchecked")
public class UserDao extends HibernateDaoSupport implements IUserDao {

	public List<User> getUserByName(final String name) {
		return getHibernateTemplate().find(
				"from User as user where user.username = ?", name);
	}

	public User save(final User user) {
		Long id = (Long) getHibernateTemplate().save(user);
		return (User) getHibernateTemplate().get(User.class, id);
	}
}
